<html>
<head>
  <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

  <title>Retira comentários de código-fonte JavaScript</title>
</head>

<body>
<form name="srcform">
  <table>
    <tr>
      <td><b>Código-fonte:</b></td>
      <td></td>
      <td><b>Resultado:</b></td>
    </tr>
    <tr>
      <td><textarea name="sourcein" rows="30" cols="60"></textarea></td>
      <td width="5%"></td>
      <td><textarea name="sourceout" rows="30" cols="60"></textarea></td>
    </tr>

    <tr>
      <td><input type="button" value="Processar" onclick="processForm();"></td>
    </tr>
    <tr>
      <td><b>Dados:</b></td>
    </tr>
    <tr>
      <td><span id="result"></td>
    </tr>
  </table>
</form>

<script src="jslexer.js"></script>

<script language="JavaScript">
function processForm()
{
  try
  {
    var source = document.srcform.sourcein.value;
    var cmtix = findMLComment(source, 0);
    var cmtend;
    if (cmtix > 0)
      cmtend = skipMLComment(source, cmtix);
    else
      cmtend = 0;
    document.srcform.sourceout.value = source.substr(cmtend);
  }
  catch (ex)
  {
    alert(ex);
  }
}
</script>

</body>
</html>
